/* 
 * Copyright 2006-2015 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.anyline.tag.des;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;

import org.apache.log4j.Logger;

import org.anyline.tag.BaseBodyTag;
import org.anyline.util.WebUtil;
/**
 * 加密
 * @author Administrator
 *
 */
public class HTMLA extends BaseBodyTag{
	private static final long serialVersionUID = 1L;
	private static Logger log = Logger.getLogger(HTMLA.class);

	private String id;
	private String name;
	private String href;
	private String clazz;
	private String style;
	private String title;
	private String target;
	private String shape;
	private String onmouseover;
	private String onmouseout;
	private String onclick;
	
	public int doEndTag() throws JspException {   
		try{
			StringBuffer buffer = new StringBuffer();
			buffer.append("<a");
			if(null != id){buffer.append(" id = \""+ id +"\"");}
			if(null != name){buffer.append(" name = \""+ name +"\"");}
			if(null != href){buffer.append(" href = \""+ WebUtil.encryptUrl(href) +"\"");}
			if(null != clazz){buffer.append(" class = \""+ clazz +"\"");}
			if(null != style){buffer.append(" style = \""+ style +"\"");}
			if(null != title){buffer.append(" title = \""+ title +"\"");}
			if(null != target){buffer.append(" target = \""+ target +"\"");}
			if(null != shape){buffer.append(" shape = \""+ shape +"\"");}
			if(null != onmouseover){buffer.append(" onmouseover = \""+ onmouseover +"\"");}
			if(null != onmouseout){buffer.append(" onmouseout id = \""+ onmouseout +"\"");}
			if(null != onclick){buffer.append(" onclick = \""+ onclick +"\"");}
			buffer.append(">");
			if(null != body){buffer.append(body);}
			buffer.append("</a>");
			JspWriter out = pageContext.getOut();
			out.print(buffer.toString());
		}catch(Exception e){
			log.error(e);
		}finally{
			release();
		}
		return EVAL_PAGE;   
	}
	@Override
	public void release() {
		super.release();
		id = null;
		name = null;
		href = null;
		clazz = null;
		style = null;
		title = null;
		target = null;
		shape = null;
		onmouseover = null;
		onmouseout = null;
		onclick = null;
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getHref() {
		return href;
	}
	public void setHref(String href) {
		this.href = href;
	}
	public String getClazz() {
		return clazz;
	}
	public void setClazz(String clazz) {
		this.clazz = clazz;
	}
	public String getStyle() {
		return style;
	}
	public void setStyle(String style) {
		this.style = style;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getTarget() {
		return target;
	}
	public void setTarget(String target) {
		this.target = target;
	}
	public String getShape() {
		return shape;
	}
	public void setShape(String shape) {
		this.shape = shape;
	}
	public String getOnmouseover() {
		return onmouseover;
	}
	public void setOnmouseover(String onmouseover) {
		this.onmouseover = onmouseover;
	}
	public String getOnmouseout() {
		return onmouseout;
	}
	public void setOnmouseout(String onmouseout) {
		this.onmouseout = onmouseout;
	}
	public String getOnclick() {
		return onclick;
	}
	public void setOnclick(String onclick) {
		this.onclick = onclick;
	}

}